//
// Unihan Input Method
//
// Copyright © 2002-2007 Sun Wah Linux Ltd.
//
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
// USA
//
// $Id: unihan_property.h 757 2007-05-10 08:19:31Z roger $
//

#ifndef _UNIHAN_PROPERTY_H
#define _UNIHAN_PROPERTY_H

typedef enum _UnihanPropertyType {
	UNIHAN_PROPERTY_NONE = 0,
	UNIHAN_PROPERTY_RUNTIME = 1,
	UNIHAN_RPOPERTY_USER = 2
} UnihanPropertyType;

typedef enum {
	UNIHAN_RUNTIME_PROPERTY_UNSPEC = 0,	//set all following properties, and set them zero
	UNIHAN_RUNTIME_PROPERTY_FULL_HALF = 1,
	UNIHAN_RUNTIME_PROPERTY_PUNC_EN_CH = 2,
	UNIHAN_RUNTIME_PROPERTY_STATE_EN_CH = 3,
	UNIHAN_RUNTIME_PROPERTY_CHARSET = 4,
	UNIHAN_RUNTIME_PROPERTY_LOCALE = 5,
	UNIHAN_RUNTIME_PROPERTY_TCSC = 6,
	UNIHAN_RUNTIME_PROPERTY_SOFT_KB = 7,
	UNIHAN_RUNTIME_PROPERTY_MAX
} UnihanRuntimePropertyType;

typedef enum{
	UNIHAN_RUNTIME_PRO_HALF = 0,
	UNIHAN_RUNTIME_PRO_FULL = 1
}RUNTIME_PRO_FULL_HALF;

typedef enum{
	UNIHAN_RUNTIME_PRO_PUNC_EN = 0,
	UNIHAN_RUNTIME_PRO_PUNC_CH = 1
}RUNTIME_PRO_PUNC_EN_CH;

typedef enum{
	UNIHAN_RUNTIME_PRO_STATE_EN = 0,
	UNIHAN_RUNTIME_PRO_STATE_CH = 1
}RUNTIME_PRO_STATE_EN_CH;

typedef enum{
	UNIHAN_RUNTIME_PRO_NO_CONV = 0,
	UNIHAN_RUNTIME_PRO_TC_SC = 1,
	UNIHAN_RUNTIME_PRO_SC_TC = 2
}RUNTIME_PRO_TCSC;

typedef enum{
	UNIHAN_SOFTKB_CLOSE = 0,
	UNIHAN_SOFTKB_OPEN = 1
}RUNTIME_PRO_SOFT_KB;


typedef enum {
	UNIHAN_SOFTKB_UNSPEC = 0,
	UNIHAN_SOFTKB_US,
	UNIHAN_SOFTKB_SYMBOL,
	//Appending... ...
	UNIHAN_SOFTKB_MAX
} UnihanSoftKBType;

typedef struct _UnihanRuntimeProperty {
	UnihanRuntimePropertyType rt_type;
	int value;
	struct _rt_prop_name {
		char *name_string;
		char *charset;
		char *language;
		int nr_name;
	} name;
	struct rt_icon {
		char *icon0;	//FALSE icon
		char *icon1;	//TRUE icon
	} icon;
} UnihanRuntimeProperty;

typedef struct _UnihanUserProperty {
	void *priv_data;
	size_t size;
} UnihanUserProperty;

typedef struct _UnihanPropertyArgs UnihanPropertyArgs, *UnihanPropertyArgList;

struct _UnihanPropertyArgs {
	UnihanPropertyType type;
	union __UnihanProperty {
		UnihanRuntimeProperty rt_property;
		UnihanUserProperty u_property;
	} unihanProperty;
	UnihanPropertyArgList next;
};



#define UNIHAN_PROPERTY_ACTIVE   1
#define UNIHAN_PROPERTY_VISIBLE  2

/**
 * @brief Struct to hold an input method property.
 *
 * For example, a Chinese input method may have properties
 * to indicate the full/half input mode of punctuations and letters.
 *
 * The members are:
 *   - key
 *     An unique key string to identify this property.
 *     Multiple properties can be organized as a tree,
 *     by using file path like key string. For example:
 *     /PropertyRoot
 *     /PropertyRoot/PropOne
 *     /PropertyRoot/PropTwo
 *     /PropertyRoot/PropThree
 *     /PropertyRoot/PropThree/PropFour
 *     /PropertyRoot/PropThree/PropFive
 *
 *     In this example, there are six properties, which are organized 
 *     into a two level tree. The root of this tree is the property "/PropertyRoot".
 *     The property "/PropertyRoot/PropThree" is a subroot which contains two
 *     sub properties.
 *
 *     This properties tree can be shown as a multilevel menu in GUI.
 *
 *   - label
 *     The label string of this property shown by GUI.
 *
 *   - icon
 *     The path of the icon file of this property.
 *
 *   - tip
 *     The tip (simple help) of this property.
 *
 *   - state
 *     The state mask of this property, can be combined by following mask:
 *     UNIHAN_PROPERTY_ACTIVE  1
 *     UNIHAN_PROPERTY_VISIBLE 2
 *     If UNIHAN_PROPERTY_ACTIVE is set then this property is active and can be triggered by user.
 *     If UNIHAN_PROPERTY_VISIBLE is set then this property is visible to user.
 */
typedef struct _UnihanProperty {
	const char *key;
	const char *label;
	const char *icon;
	const char *tip;
	int         state;
} UnihanProperty;
/**
 * @brief Struct to hold a set of properties.
 * 
 * The members are:
 *   - nr_properties
 *     The number of properties in this list.
 *   - properties
 *     Array to hold the properties.
 */
typedef struct _UnihanPropertyList {
    int           propertiesNum;
    UnihanProperty *properties;
} UnihanPropertyList;

typedef struct _PropertyTree {
        GNode* root;
        int num_node;
        int depth;
} PropertyTree;

typedef struct _PropertyNode {
        UnihanProperty* property;
        GtkWidget* widget;
} PropertyNode;
/*typedef struct treeNode{
	char *key;
	treeNode *children;
	treeNode *next;
	UnihanProperty *pUnihanProperty;
	//GtkWidget *pGtkWidget;
}treeNode;*/
#endif /* _UNIHAN_PROPERTY_H */



/*----------------------------------------------------------------------------*/

// vi:ts=4:nowrap:cin:expandtab
